package com.cysyz.web.modules.base.businesslog.controller;

import com.cysyz.web.modules.base.businesslog.domain.SysBusinessLog;
import com.cysyz.web.modules.base.businesslog.service.BusinessLogService;
import com.cysyz.web.modules.base.permission.annotation.Module;
import com.cysyz.web.modules.base.permission.annotation.ModuleFunction;
import com.cysyz.web.modules.base.permission.support.ModuleFunctionType;
import com.cysyz.web.modules.base.support.SysConstants;
import com.cysyz.web.modules.base.support.controller.SpringMVCBaseController;
import net.sf.json.JsonConfig;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;



@Controller
@RequestMapping("/businesslog")
@Module(name="业务日志", code = "businesslog")
public class BusinessLogController extends SpringMVCBaseController {
    //默认多列排序,example: username desc,createTime asc
    protected static final String DEFAULT_SORT_COLUMNS=null;

    public static final String PAGE_PATH_PREFIX = SysConstants.BACK_PAGE_DIR_PATH + "/businesslog";

    @Resource
    private BusinessLogService businessLogService;

    private final String LIST_ACTION="redirect:list.do";


    /** 列表 */
    @RequestMapping("/list")
    @ModuleFunction(value = "日志列表", moduleFunctionType = ModuleFunctionType.MENU)
    public String list(){
        return this.PAGE_PATH_PREFIX + "/businesslog_list";
    }

    /** 查询 */
    @RequestMapping("/search")
    @ResponseBody
    @ModuleFunction(value = "日志查询", menuPrivilegeMethodName = "list")
    public String search(SysBusinessLog businessLog,int start,int length){

        businessLog.setOperationName(transcodingIfGet(businessLog.getOperationName()));

        return responseJSON(businessLogService.getBusinessLogList(businessLog));
    }
}

